import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import "./res/listData.dart";

void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('你好flutter1')),
        body: const MyApp(),
      ),
    ),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Row(
          children: [
            ElevatedButton(
              onPressed: () {},
              style: ButtonStyle(
                  // 圆角弧度
                  shape: MaterialStateProperty.all(
                    RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(10),
                    ),
                  ),
                  // 背景色
                  backgroundColor: MaterialStateProperty.all(Colors.teal),
                  // 文字色
                  foregroundColor: MaterialStateProperty.all(Colors.white)),
              child: const Text('普通按钮'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('文本按钮'),
            ),
            OutlinedButton(
              onPressed: () {},
              child: const Text('边框按钮'),
            ),
            IconButton(
              onPressed: () {
                print('icon按钮');
              },
              icon: const Icon(Icons.screen_lock_landscape_sharp),
            )
          ],
        ),
        const SizedBox(height: 30),
        Column(
          children: [
            ElevatedButton.icon(
              onPressed: () {},
              icon: const Icon(Icons.access_alarms_outlined),
              label: const Text('普通icon按钮'),
            ),
            TextButton.icon(
              onPressed: () {},
              icon: Icon(Icons.accessibility_sharp),
              label: const Text('文本icon按钮'),
            ),
            OutlinedButton.icon(
              onPressed: () {},
              icon: Icon(Icons.accessibility_sharp),
              label: const Text('边框icon按钮'),
            ),
          ],
        ),
        const SizedBox(height: 50),
        Column(
          children: [
            SizedBox(
              height: 60,
              width: 200,
              child: ElevatedButton(
                onPressed: () {},
                child: Text('修改尺寸按钮'),
              ),
            ),
            SizedBox(
              height: 40,
              width: double.infinity,
              child: Expanded(
                flex: 1,
                child: ElevatedButton.icon(
                  onPressed: () {},
                  icon: const Icon(Icons.access_alarms_outlined),
                  label: const Text('修改尺寸按钮'),
                ),
              ),
            )
          ],
        ),
        const SizedBox(height: 30),
        Row(
          children: [
            SizedBox(
              height: 80,
              width: 80,
              child: ElevatedButton(
                onPressed: () {},
                style: ButtonStyle(
                    shape: MaterialStateProperty.all(
                      const CircleBorder(
                        side: BorderSide(
                          color: Colors.red,
                        ),
                      ),
                    ),
                    foregroundColor: MaterialStateProperty.all(Colors.teal)),
                child: const Text('原型按钮'),
              ),
            )
          ],
        )
      ],
    );
  }
}
